package com.blackcat.mybatisplus.wrapper.config;

import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.wrapper.MapWrapper;

import java.util.Map;

/**
* mybatis返回字段转小写
* @author zhanghui
* @since 2023/4/20 09:22
*/
public class SqlFieldToLowerCase extends MapWrapper {

    public SqlFieldToLowerCase(MetaObject metaObject, Map<String, Object> map) {
        super(metaObject, map);
    }

    @Override
    public String findProperty(String name, boolean useCamelCaseMapping) {
        if (useCamelCaseMapping) {
            //查询字段转小写
            return name == null ? null : name.toLowerCase();
        }
        return name;
    }

}
